package ControlLayer;
import ModelLayer.*;
import java.util.ArrayList;

public class SaleCTR
{
   private ProductCTR productCTR;
   private CustomerCTR customerCTR;
   private StaffCTR staffCTR;
   private SaleContainer saleContainer;
   public SaleCTR()
   {
        productCTR = new ProductCTR();
        customerCTR = new CustomerCTR();
        staffCTR = new StaffCTR();
        saleContainer = SaleContainer.getInstance();
   }
   public void createSale(int productID, int serial, int saleID, String phone, String seller)
   {
       Customer customer;
       customer = customerCTR.getCustomer(phone);
       Specimen specimen;
       specimen = productCTR.getSpecimen(productID, serial);
       Staff staff;
       staff = staffCTR.getStaff(seller);
       saleContainer.createSale(customer,  specimen, staff, saleID);
       
   }
   public Product findProduct(int id)
   {
       return productCTR.findProduct(id);
   }
   public Customer findCustomer(String phone)
   {
       return customerCTR.getCustomer(phone);
   }
   public ArrayList<Sale> findAllSales(String phone)
   {
       return saleContainer.findAllSales(phone);
   }
}
